﻿<%@ WebHandler Language="C#" Class="ClassComplete" %>

using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Web;
using VideoClassLibrary.BusinessLogicLayer;
using VideoClassLibrary.CacheManager;
using VideoClassLibrary.Model;

public class ClassComplete : IHttpHandler
{
    
    public void ProcessRequest (HttpContext context) {
        string query = context.Request.QueryString["q"];
        StringBuilder buffer = new StringBuilder();
        TrainClassModule trainingModule = new TrainClassModule();
        V_adminUser vAdminUser = CommonCacheManager.GetCacheData<V_adminUser>("AdminUser");
        DataSet ds = trainingModule.GetTrainclassListByWhere(vAdminUser.SchoolID, "  and LOWER(VTC_name) like '" + query.ToLower() + "%' and IsPublish=1");
       // buffer.Append("[");
        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
           
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                buffer.AppendFormat(" 班名：{0},{0},{1}\r\n", ds.Tables[0].Rows[i]["VTC_name"], ds.Tables[0].Rows[i]["id"]);

            }
        }
        buffer.Remove(buffer.Length - 1, 1);
       // buffer.Append("]");
         context.Response.Write(buffer.ToString());
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}